package com.fit.spring.boot.proxy.extension.interceptor;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

import org.aopalliance.intercept.MethodInterceptor;

/**
 * 拦截器配置器
 * @author hcl
 *
 */
public class Config {
	
	/**
	 * 拦截器
	 */
	private List<MethodInterceptor> methodInterceptors = new ArrayList<MethodInterceptor>();
	
	/**
	 * beanclass对象
	 */
	private Class<?> beanClass;
	
	/**
	 * 方法对象
	 */
	private Method method;
	
	
	public Config(Class<?> beanClass, Method method) {
		super();
		this.beanClass = beanClass;
		this.method = method;
	}

	/**
	 * 添加拦截器
	 * @param methodInterceptor
	 */
	public void addMethodInterceptor(MethodInterceptor methodInterceptor){
		methodInterceptors.add(methodInterceptor);
	}
	
	/**
	 * 添加多个拦截器
	 * @param methodInterceptor
	 */
	public void addMethodInterceptor(List<MethodInterceptor> methodInterceptors){
		methodInterceptors.addAll(methodInterceptors);
	}
	
	/**
	 * 获取所有的拦截器
	 * @return
	 */
	public List<MethodInterceptor> getMethodInterceptors(){
		return methodInterceptors;
	}

	public Class<?> getBeanClass() {
		return beanClass;
	}

	public void setBeanClass(Class<?> beanClass) {
		this.beanClass = beanClass;
	}

	public Method getMethod() {
		return method;
	}

	public void setMethod(Method method) {
		this.method = method;
	}
}
